package entity

import (
	"time"

	"gorm.io/gorm"
	"shqsoft.cn/pas3ui/base"
)

//CompAccoFlowChUpdate
type CompAccoFlowChUpdate struct {
	ACID    int             `gorm:"column:ACID;primary_key;"`
	CUNM    string          `gorm:"column:CUNM"`
	UTNM    string          `gorm:"column:UTNM"`
	ITNM    string          `gorm:"column:ITNM"`
	OPDT    time.Time       `gorm:"column:OPDT"`
	ACNO    string          `gorm:"column:ACNO"`
	BANO    string          `gorm:"column:BANO"`
	CYNM    string          `gorm:"column:CYNM"`
	CLDT    time.Time       `gorm:"column:CLDT"`
	ACBL    float64         `gorm:"column:ACBL"`
	ISDIVI  int             `gorm:"column:ISDIVI"`
	Bgqdivi []base.DiviDesc `gorm:"-" json:"Bgqdivi"`
}

//TableName
func (CompAccoFlowChUpdate) TableName() string {
	return "V_COMP_ACCO_FLOW_UPDATE"
}

// AfterFind 查询后触发器
func (i *CompAccoFlowChUpdate) AfterFind(tx *gorm.DB) (err error) {
	i.ACNO = base.CdnoTM(i.ACNO)
	i.BANO = base.AcnoTM(i.BANO)
	d, err := base.GetDiviMap(base.Comp, i.ACID)
	if err != nil {
		return err
	}
	i.Bgqdivi, err = d.GetDesc()
	return
}
func CompAccoFlowChUpdateEF() base.EntityFunc {
	return func() interface{} {
		entity := CompAccoFlowChUpdate{}
		return &entity
	}
}
func CompAccoFlowChUpdateESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []CompAccoFlowChUpdate
		return &entities
	}
}

func init() {
	base.DaoPoolObj.Put("CompAccoFlowChUpdate", base.NewDefaultDao(CompAccoFlowChUpdateEF(), CompAccoFlowChUpdateESF(), nil, "ch"))
}
